package com.itheima.consumer.listener;

import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

/**
 * @author slacker
 * @create 2024-12-27
 */
//@Component
public class MqWorkQueueMessageListener {
    @RabbitListener(queues = {"work.queue"})
    public void onMessage1(String msg) throws InterruptedException {
        System.out.println("消费者1"+msg+"时间："+ LocalDateTime.now());
        Thread.sleep(20);
    }
    @RabbitListener(queues = {"work.queue"})
    public void onMessage2(String msg) throws InterruptedException {
        System.out.println("消费者2"+msg+"时间："+ LocalDateTime.now());
        Thread.sleep(200);
    }
}
